<template>
	<section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="filters">
				<el-form-item>
					<el-input v-model="filters.content" placeholder="内容"></el-input>
				</el-form-item>
				<el-form-item>
					<el-select v-model="filters.moudleid" size="70px" placeholder="请选择模块" style="width:200px;">
						<el-option
                                v-for="(item,index) in options"
                                :key="index"
                                :label="item.label"
                                :value="item.value"></el-option>
					</el-select>
				</el-form-item>
				<el-form-item>
					<el-input v-model="filters.operateuser" placeholder="操作人"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" v-on:click="getLogInfoList">查询</el-button>
				</el-form-item>
			</el-form>
		</el-col>

		<!--列表-->
		<el-table :data="users" highlight-current-row v-loading="listLoading" style="width: 100%;">
			<el-table-column type="selection" width="55">
			</el-table-column>
			<el-table-column prop="content" label="日志内容"></el-table-column>
			<el-table-column prop="operateuser" label="操作人"></el-table-column>
			<el-table-column prop="moudleid" label="模块" :formatter="formatmoudle"></el-table-column>
			<el-table-column prop="addtime" label="操作时间"></el-table-column>
		</el-table>
	</section>
</template>

<script>
	import util from '../../common/js/util'
	import { getUserListPage, removeUser, batchRemoveUser, editUser, addUser } from '../../api/api';

	export default {
		data() {
			return {
				options: [{
					value: '0',
					label: '老师'
				}, {
					value: '1',
					label: '学生'
				}, {
					value: '2',
					label: '班级'
				}],
				filters: {
					name: ''
				},
				users: [],
				total: 0,
				page: 1,
				listLoading: false,
				sels: [] //列表选中列
			}
		},
		methods: {
			formatmoudle: function (row, column) {
				if(row.moudleid == 0){
					return "老师";
				}else if(row.moudleid == 1){
					return "学生";
				}else{
					return "班级";
				}
			},
			//获取用户列表
			getLogInfoList() {
				let para = {
					page: this.page,
					content: this.filters.content,
					moudle: this.filters.moudleid,
					operateuser: this.filters.operateuser
				};
				this.listLoading = true;
				this.$http.post("/log/listpage", para).then((res) => {
					this.total = res.data.total;
					this.users = res.data.list;
					this.listLoading = false;
				});
			}
		},
		mounted() {
			this.getLogInfoList();
		}
	}

</script>

<style scoped>

</style>